package com.hjh.thymeleafdemo.service.Impl;

import com.hjh.thymeleafdemo.entity.User;
import com.hjh.thymeleafdemo.repository.UserRepository;
import com.hjh.thymeleafdemo.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class IUserServiceImpl implements IUserService {

    @Resource
    private UserRepository userRepository;

    @Override
    public User login(String usrName, String userPassword) {
        return userRepository.findUserByUsrNameAndUsrPassword(usrName,userPassword);
    }

    @Override
    public User addUser(User user) {
        return null;
    }

    @Override
    public void deleteUser(Long usrId) {

    }

    @Override
    public User updateUser(User user) {
        return null;
    }

    @Override
    public User getUser(Long usrId) {
        return userRepository.getOne(usrId);
    }

    @Override
    public List<User> findAllUsers() {
        return userRepository.findAll();
    }
}
